# final_check.py
import sys
import importlib.util

def check_module(module_name):
    """检查模块是否可导入"""
    spec = importlib.util.find_spec(module_name)
    if spec is None:
        print(f"❌ {module_name}: 找不到模块")
        return False
    else:
        print(f"✅ {module_name}: 找到于 {spec.origin}")
        return True

print("🔍 最终环境检查:")
print(f"Python: {sys.executable}")
print()

# 检查关键模块
modules = ["uvicorn", "fastapi", "fastapi.middleware.cors", "mcp"]
all_ok = True

for module in modules:
    if not check_module(module):
        all_ok = False

print()
if all_ok:
    print("🎉 所有依赖检查通过!")
else:
    print("❌ 有依赖未正确安装")
    print("💡 请运行:")
    print(f"   {sys.executable} -m pip install uvicorn fastapi")